/*
2021-7-28
https://www.acwing.com/problem/content/104/
*/
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;
const int N=100005;
double a[N];
int n,k;

bool check(double avg)
{
    double s[N];
    for(int i=1;i<=n;i++)
        s[i]=s[i-1]+a[i]-avg;
    
    double minv=0;
    for(int i=k;i<=n;i++)
    {
        minv=min(minv,s[i-k]);
        if(s[i]>=minv) return true;
    }
    
    return false;
}

int main()
{
    double l=0,r=0;
    cin>>n>>k;
    
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        r=max(r,a[i]);
    }
    
    while(r-l>1e-5)
    {
        double mid=(r+l)/2;
        if(check(mid)) l=mid;
        else r=mid;
    }
    
    printf("%d\n",(int)(r*1000));
    
    return 0;
}
